[Unit]
Description=Named network namespace %I
Documentation=https://github.com/openstack/ansible-role-systemd_service
After=syslog.target
After=network.target
{% if not (systemd_PrivateNetworkIsolated | bool) %}
BindsTo=systemd-netns-access@%i.service
{% endif %}
JoinsNamespaceOf=systemd-netns@%i.service


[Service]
Type=oneshot
RemainAfterExit=true
PrivateNetwork=true

# Start process
ExecStartPre=-/usr/bin/env ip netns delete %I
ExecStart=/usr/bin/env ip netns add %I
ExecStart=/usr/bin/env ip netns exec %I ip link set lo up
ExecStart=/usr/bin/env umount /var/run/netns/%I
ExecStart=/usr/bin/env mount --bind /proc/self/ns/net /var/run/netns/%I

# Stop process
ExecStop=/usr/bin/env ip netns delete %I


[Install]
WantedBy=multi-user.target
WantedBy=network-online.target
